<template>
	<view>
		<view class="title">
			设置密码
		</view>
		<view class="hint">
			为保证你的账户安全，请输入登录密码
		</view>
		<view class="edit">
			<view class="cellphone">
				<image src="../../static/mm.png" mode=""></image>
				<input type="text" password  value="" placeholder="新的密码" v-model="pwd"/>
			</view>
			<view class="verify">
				<image src="../../static/mms.png" mode=""></image>
				<input type="text" password  value="" placeholder="确认密码" v-model="pwds"/>
			</view>
		</view>
		 <view class="step" @click="ensure">确定</view>
	</view>
</template>

<script>
	import {
		register
	} from "@/nxTemp/apis/login.js"
	export default {
		data() {
			return {
				pwd:'',
				pwds:'',
				tel:'',
				dete:{}
			}
		},
		onLoad(datum) {
			console.log(datum)
			this.tel=datum.tel
		},
		methods:{
			ensure(){
				if(this.pwd!=''){
					if(this.pwds!=''){
						if(this.pwd==this.pwds){
							// uni.navigateTo({
							//     url: 'pages/login/message'
							// });						
							register({
								tel:'',
								pwd:this.pwd,
								account:this.tel,
								address:'',
								cardId:'',
								headPortrait:'',
								lat:'',
								lng:'',
								permit:'',
								photo:'',
								sex:0,
								type:0,
								userName:''
							}).then(res=>{
								console.log(res)
								//保存token到缓存
								uni.setStorageSync("token", res.token)
								//保存用户编号
								uni.setStorageSync("userId", res.id)
								uni.setStorageSync("user", res)
								this.$Router.pushTab({
									path: '/pages/taBar/social/social',
								});
							})
							
						}else{
							uni.showToast({
								title:'密码不同，确认后输入',
								icon:'none'
							})
						}
					}else{
						uni.showToast({
							title:'确认密码不能为空',
							icon:'none'
						})
					}
				}else{
					uni.showToast({
						title:'密码不能为空',
						icon:'none'
					})
				}
				
			}
		}

	}
</script>

<style>
	.title {
		color: #000000;
		font-size: 38rpx;
		width: 100%;
		text-align: center;
		font-weight: 600;
		padding-top: 52rpx;
	}
	.hint{
		color: #000000;
		font-size: 25rpx;
		width: 100%;
		text-align: center;
		font-weight: 600;
		margin-top: 12rpx;
	}

	.edit {
		margin: 0 49rpx;
		box-shadow: 0px 4rpx 28rpx 0px #D8D8D8;
		border-radius: 21rpx;
		margin-top: 86rpx;
		padding-bottom: 70rpx;
	}

	.cellphone {
		margin: 0 31rpx;
		border-bottom: 2rpx solid #CCCCCC;
		padding-top: 62rpx;
		display: flex;
		align-items: center;
	}

	.cellphone image {
		width: 61rpx;
		height: 61rpx;
		/* flex: 1; */
	}

	.cellphone input {
		margin-left: 17rpx;
		flex: 1;
		/* margin-top: 5rpx; */
	}

	.verify {
		margin: 0 31rpx;
		border-bottom: 2rpx solid #CCCCCC;
		padding-top: 36rpx;
		display: flex;
		align-items: center;
	}

	.verify image {
		width: 61rpx;
		height: 61rpx;
	}

	.verify input {
		margin-left: 17rpx;
		flex: 1;
	}

	.code {
		font-size: 30rpx;
		color: #2AAB39;
		padding-right: 25rpx;
	}
	.step{
		margin: 76rpx 49rpx 0 49rpx;
		color: #FFFFFF;
		background-color: #2AAB39;
		text-align: center;
		border-radius: 8rpx;
		font-size: 33rpx;
		padding: 33rpx 0;
		
	}
</style>
